fix(parser): anchor comment directives correctly and quote injected descriptions - #1896
Merged
Conversation
The @Description/@Interactive/@InjectSSHAgent/@NoArtifactsToSource injection used /\w:/ to find the job to attach a pending directive to. That regex also matches a colon inside a comment line, so a multi-line '# @description ...: ...' block (or any comment containing 'word:') was treated as the anchor. The 2-space 'gclDescription:' line then got spliced in after a comment, landing on the previous job — producing a duplicate mapping key and the 'duplicated mapping key detected! Values will be overwritten!' warning. Skip comment lines entirely when scanning for the anchor, and only anchor on a real top-level key (/^[\w.$-]+:/) so indented keys and comments can never be mistaken for a job.
The top-level key anchor rejected any name outside [\w.$-], so a directive above "deploy to prod:" or "build/image:" was never consumed and drifted onto the next matching job.
A description containing a colon was spliced in unquoted and produced invalid YAML.
Asserts each @description lands on its own job, across a multi-line comment whose text contains a colon, a job name with spaces and one with a slash.
firecow
marked this pull request as ready for review
July 31, 2026 07:43
The widened anchor newly matches quoted keys, which neither master nor the original anchor did.
|
tmeijn
pushed a commit
to tmeijn/dotfiles
that referenced
this pull request
Aug 11, 2026
This MR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---|---|---| | [npm:gitlab-ci-local](https://github.com/firecow/gitlab-ci-local) | `4.73.0` → `4.74.0` |  |  |  |  | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>firecow/gitlab-ci-local (npm:gitlab-ci-local)</summary> ### [`v4.74.0`](https://github.com/firecow/gitlab-ci-local/releases/tag/4.74.0) [Compare Source](firecow/gitlab-ci-local@4.73.0...4.74.0) #### What's Changed - fix: introduce per-job cert volume with %gcl% token by [@​ticapix](https://github.com/ticapix) in [#​1877](firecow/gitlab-ci-local#1877) - fix: pull registry probe image before the timed readiness check by [@​firecow](https://github.com/firecow) in [#​1904](firecow/gitlab-ci-local#1904) - fix(parser): anchor comment directives correctly and quote injected descriptions by [@​firecow](https://github.com/firecow) in [#​1896](firecow/gitlab-ci-local#1896) **Full Changelog**: <firecow/gitlab-ci-local@4.73.0...4.74.0> </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yODguMCIsInVwZGF0ZWRJblZlciI6IjQzLjI4OC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiLCJhdXRvbWF0aW9uOmJvdC1hdXRob3JlZCIsImRlcGVuZGVuY3ktdHlwZTo6bWlub3IiXX0=-->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Comment directives were anchored with
/\w:/, which also matched aword:inside a comment, so a multi-line# @Descriptioncontaining a colon attached the injected key to the wrong job; directives now anchor only on unindented non-comment keys and injected descriptions are quoted so a colon in the text cannot produce invalid YAML.The description-quoting bug is present on master independently of this change.
Summary by cubic
Fixed directive injection to skip comment lines, anchor on real top-level job keys (including names with spaces, slashes, and quoted keys), and quote description values. Prevents mis-anchoring and invalid YAML, removing the "duplicated mapping key detected" warning.
/^[^\s#].*:/; ignore#lines and indented keys. Supports names with spaces, slashes, and quoted keys.gclDescriptionvalues to handle colons and quotes in descriptions.Written for commit 0792fc5. Summary will update on new commits.